﻿using System;
using System.Windows;
using System.Windows.Media;
using System.Windows.Controls;

using SBPweb.Communication.Shared.Library.Conversations;

namespace SBPweb.Communication.Client.Controls.Xmpp.Conversations
{

    public partial class MessageView : UserControl
    {

        #region Constructor logic

        public MessageView()
        {
            InitializeComponent();
        }

        public MessageView(MessageBase message)
            : this()
        {
            this.Message = message;
            this.DataContext = message;
            if (message.IsMyOwn)
            {
                spMessage.Background = new SolidColorBrush(Color.FromArgb(64, 192, 192, 255));
            }
        }

        static MessageView()
        {
            MessageProperty = DependencyProperty.Register("Message", typeof(MessageBase), typeof(MessageView), null);
        }

        #endregion

        #region Dependency properties

        public static readonly DependencyProperty MessageProperty;

        #endregion

        #region Property accessors

        public MessageBase Message
        {
            get
            {
                return (MessageBase)this.GetValue(MessageProperty);
            }
            set
            {
                this.SetValue(MessageProperty, value);
            }
        }

        #endregion

    }

}